package com.echovin.esb.gateway.service.impl;

import com.echovin.esb.gateway.mapper.GatewayIPLimitMapper;
import com.echovin.esb.gateway.model.GatewayIPLimitApi;
import com.echovin.esb.gateway.service.GatewayIPLimitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GatewayIPLimitServiceImpl implements GatewayIPLimitService {
    @Autowired
    GatewayIPLimitMapper gatewayIPLimitMapper;

    public GatewayIPLimitServiceImpl() {
    }


    @Override
    public List<GatewayIPLimitApi> findBlackList() {
        List<GatewayIPLimitApi> blackList = gatewayIPLimitMapper.getIPLimits(1);
        return blackList;
    }

    @Override
    public List<GatewayIPLimitApi> findWhiteList() {
        List<GatewayIPLimitApi> whiteList = gatewayIPLimitMapper.getIPLimits(2);
        return whiteList;
    }

    @Override
    public List<GatewayIPLimitApi> findIpLimitApiList(Integer policyId) {
        List<GatewayIPLimitApi> list = gatewayIPLimitMapper.getIPLimits(policyId);
        return list;
    }

    @Override
    public int delete(GatewayIPLimitApi record) {
        return gatewayIPLimitMapper.delete(record);
    }

    @Override
    public int update(GatewayIPLimitApi record) {
        return gatewayIPLimitMapper.update(record);
    }

    @Override
    public GatewayIPLimitApi getIpLimitPolicy(short policyId) {
        return null;
    }

    @Override
    public GatewayIPLimitApi addIpLimitPolicy(GatewayIPLimitApi policy) {
        return null;
    }

    @Override
    public GatewayIPLimitApi updateIpLimitPolicy(GatewayIPLimitApi policy) {
        return null;
    }

    @Override
    public void removeIpLimitPolicy(short policyId) {

    }

    @Override
    public void addIpLimitApis(short policyId, String... apis) {

    }

    @Override
    public void clearIpLimitApisByPolicyId(short policyId) {

    }

    @Override
    public void clearIpLimitApisByApiId(short apiId) {

    }
}
